/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Traitement;

import test_porte_variable.Machine;

/**
 *
 * @author phoebus
 */
public class Pivot {
/**
 * Reçoit le mot majeur de la phrase APT
 * Affecte la phrase pivot qui correspond
 *  * 
 * @param majeur Mot majeur de phrase APT
 * @return une lste d'instruction pivot
 */
    public static String[] pivot(String majeur) {
        String[] lepivot = null;

        switch (majeur) {
            case "SPINDL":
                switch (Machine.sens_rotation.getetat()) {
                    case "OFF":
                        lepivot = (Machine.grammaire_OFF).split(",");
                        
                        break;
                    case "CW":
                        lepivot = (Machine.grammaire_CW).split(",");

                        break;
                    case "CCW":
                        lepivot = (Machine.grammaire_CCW).split(",");
                        break;
                    default:
                        // gerer un affichage d erreur
                        break;
                }

                break;
            case "LOAD_TOOL":
                String letexte_load_tool = Machine.grammaire_HEAD_OPERATION+",LS,"+Machine.grammaire_LOAD_TOOL;
                lepivot = letexte_load_tool.split(",");
                break;
            case "DEPLACEMENT":
                switch (Machine.interpol.getetat()) {
                    case "RAPID":
                        lepivot = (Machine.grammaire_DEPLACEMENT_RAPID).split(",");

                        break;
                    case "PROGRAMME":
                        lepivot = (Machine.grammaire_DEPLACEMENT_PROGRAMME).split(",");

                        break;
                    case "CIRCULAIRE":
                        lepivot = (Machine.grammaire_DEPLACEMENT_CIRCULAIRE).split(",");

                        break;
                }
                break;
            case "PARTNO":
                String letexte_partno = Machine.grammaire_PARTNO+ ",LS,"+Machine.grammaire_HEAD_PROG;
                lepivot = letexte_partno.split(",");

                break;
            case "COOLNT":

                lepivot = (Machine.grammaire_COOLNT).split(",");
                break;
            case "STOP":
                lepivot = (Machine.grammaire_STOP).split(",");

                break;
            case "HEAD_OPERATION":
                lepivot = (Machine.grammaire_HEAD_OPERATION).split(",");

                break;
            case "HEAD_PROG":
                lepivot = (Machine.grammaire_HEAD_PROG).split(",");

                break;
            case "END_PROG":
                lepivot = (Machine.grammaire_END_PROG).split(",");

                break;
            case "COMMENT":
                lepivot = (Machine.grammaire_COMMENT).split(",");

                break;
            case "CORRECTORS":
                lepivot = (Machine.grammaire_CORRECTORS).split(",");

                break;
                
                
        }


        return lepivot;
    }
}
